/**
 * 
 */
package com.media.module.view;

import com.media.module.utils.ActivityStyle;
import com.media.module.utils.DimenValues;
import com.media.module.utils.MResource;
import com.media.module.utils.UIGlobalDef;

import android.content.Context;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

/**
 * TODO
 * 
 * @author dell 2016骞�7鏈�24鏃ヤ笂鍗�11:15:11 HeaderView.java
 */
public class HeaderView extends LinearLayout {

	private Context mContext;

	public HeaderView(Context context) {
		super(context);
		mContext = context;
		onCreateView();
	}

	private void onCreateView() {
		DisplayMetrics dMetrics = mContext.getResources().getDisplayMetrics();
		float lfBaseDim = MResource.applyDimension(TypedValue.COMPLEX_UNIT_DIP, DimenValues.BASE_VALUE, dMetrics);
		// Cancel
		RelativeLayout lrlCancel = new RelativeLayout(mContext);
		lrlCancel.setLayoutParams(ActivityStyle.getTibStyleParams());
		ImageView livCancel = new ImageView(mContext);
		livCancel.setId(UIGlobalDef.VIEW_ID.CANCEL);
		String[] strBack = { "ic_btn_cancel.png", "ic_btn_cancel_pressed.png" };
		livCancel.setImageDrawable(MResource.getSelectorDrawable(mContext, strBack));
		livCancel.setLayoutParams(ActivityStyle.getImageButtonLayoutParams(lfBaseDim / 2));
		lrlCancel.addView(livCancel);
		addView(lrlCancel);
		
		// Facing
		RelativeLayout lrlTopSwitch = new RelativeLayout(mContext);
		lrlTopSwitch.setLayoutParams(ActivityStyle.getTibStyleParams());
		ImageView livCameraFacing = new ImageView(mContext);
		livCameraFacing.setId(UIGlobalDef.VIEW_ID.CAMERA_FACING);
		String[] strFacing= { "ic_setting_switch.png", "ic_setting_switch_pressed.png" };
		livCameraFacing.setImageDrawable(MResource.getSelectorDrawable(mContext, strFacing));
		livCameraFacing.setLayoutParams(ActivityStyle.getImageButtonLayoutParams(lfBaseDim / 2));
		lrlTopSwitch.addView(livCameraFacing);
		addView(lrlTopSwitch);
		
		// Flash
		RelativeLayout lrlTopFlash = new RelativeLayout(mContext);
		ImageView livFlashLight = new ImageView(mContext);
		livFlashLight.setId(UIGlobalDef.VIEW_ID.CAMERA_FLASH);
		String[] strFlashOffLight = { "ic_btn_flash_always_on.png", "ic_btn_flash_always_on.png" };
		livFlashLight.setImageDrawable(MResource.getSelectorDrawable(mContext, strFlashOffLight));
		livFlashLight.setLayoutParams(ActivityStyle.getImageButtonLayoutParams(lfBaseDim / 2));
		lrlTopFlash.addView(livFlashLight);
		lrlTopFlash.setLayoutParams(ActivityStyle.getTibStyleParams());
		addView(lrlTopFlash);
		
		// Rotate
		RelativeLayout lrlPhotoRotate = new RelativeLayout(mContext);
		lrlPhotoRotate.setLayoutParams(ActivityStyle.getTibStyleParams());
		ImageView ivPhotoRotate = new ImageView(mContext);
		ivPhotoRotate.setId(UIGlobalDef.VIEW_ID.CAMERA_PHOTO_PREVIEW_ROATE);
		String[] strRotate = { "ic_rotate.png", "ic_rotate_pressed.png" };
		ivPhotoRotate.setImageDrawable(MResource.getSelectorDrawable(mContext, strRotate));
		ivPhotoRotate.setLayoutParams(ActivityStyle.getImageButtonLayoutParams(lfBaseDim / 2));
		ivPhotoRotate.setVisibility(View.GONE);
		lrlPhotoRotate.addView(ivPhotoRotate);
		addView(lrlPhotoRotate);
		
		// OK
		RelativeLayout lrlTopOk = new RelativeLayout(mContext);
		lrlTopOk.setLayoutParams(ActivityStyle.getTibStyleParams());
		ImageView livOK = new ImageView(mContext);
		livOK.setId(UIGlobalDef.VIEW_ID.OK);
		String[] strFinish = { "btn_check_on_emui.png", "btn_check_on_pressed_emui.png" };
		livOK.setImageDrawable(MResource.getSelectorDrawable(mContext, strFinish));
		livOK.setLayoutParams(ActivityStyle.getImageButtonLayoutParams(lfBaseDim / 2));
		livOK.setVisibility(View.GONE);
		lrlTopOk.addView(livOK);
		addView(lrlTopOk);
	}

}
